#include <stdio.h>
#include <pthread.h>


void * start_routine(void * arg)
{
    printf("sub thread is running.\n");
    printf("sub thread id is %ld\n", pthread_self());

    while(1);

    return NULL;//返回的是空指针
}

int main()
{
    pthread_t pthid = 0;
    ///经过pthread_create函数之后，pthid的值会进行修改
    pthread_create(&pthid, NULL, start_routine, NULL);

    //打印pthid是在主线程中进行的
    printf("main: sub thread id is %ld\n", pthid);
    printf("main thread id is %ld\n", pthread_self());

    printf("main thread is running\n");
    while(1);
    return 0;
}

